package cn.wmw.xyy.service.impl;

import cn.wmw.result.JsonResult;
import cn.wmw.xyy.domain.CodeUser;
import cn.wmw.xyy.mapper.CodeUserMapper;
import cn.wmw.xyy.service.ICodeUserService;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wmw
 * @since 2023-01-29
 */
@Service
public class CodeUserServiceImpl extends ServiceImpl<CodeUserMapper, CodeUser> implements ICodeUserService {



    @Override
    public CodeUser selectByUserId(long l) {
        Wrapper<CodeUser> wrapper = new EntityWrapper<>();
        wrapper.eq("user_id", l);
        CodeUser codeUser = selectOne(wrapper);
        return codeUser;
    }

    @Override
    public JsonResult selectByLinkCode(String linkCode) {
        Wrapper<CodeUser> wrapper = new EntityWrapper<>();
        wrapper.eq("code", linkCode);
        CodeUser codeUser = selectOne(wrapper);
        return JsonResult.success(codeUser);
    }
}
